import * as veelidate from 'vee-validate';
import rules from '@vee-validate/rules';
import { localize } from '@vee-validate/i18n';
import zh_CN from '@vee-validate/i18n/dist/locale/zh_CN.json';

veelidate.configure({
  //中文支持
  generateMessage: localize('zh_CN', zh_CN),
  //input事件时验证
  validateOnInput: false,
  validateOnBlur: true,
});

Object.keys(rules).forEach((key) => {
  veelidate.defineRule(key, rules[key]);
});

export default veelidate;
